package com.gitee.free2free.study.elastic.repository;


import com.gitee.free2free.study.elastic.entity.OrderEntity;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * @author lfg
 */
public interface OrderRepository extends CrudRepository<OrderEntity, String> {

    OrderEntity findFirstBySpuId(String spuId);

    @Override
    List<OrderEntity> findAll();

    @Query(value = "{\n" +
            "  \"match\": {\n" +
            "    \"adminId\": {\n" +
            "      \"query\": \"?0\"\n" +
            "    }\n" +
            "  }\n" +
            "}")
    List<OrderEntity> findByAdminId(String adminId);
}
